const {BrowserWindow, app} = require('electron')
const path = require('path')
let window
app.on('ready', function () {
    window = new BrowserWindow({
        width: 1000,
        height: 800,
        webPreferences: {
            //开启node支持
            nodeIntegration: true,
            contextIsolation: false,
            //开启webview支持
            webviewTag: true,
            preload: path.resolve(__dirname, '../preload/preload.js') //预加载脚本
        }
    })
    window.loadURL(app.isPackaged //判断是否打包
        ? path.resolve(__dirname, '../render/index.html')
        : `http://localhost:${process.env.VITE_PORT}#/`)
})